package ead.cs.service;


import com.google.gson.Gson;
import ead.cs.domain.alert.Message;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(value = SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:test-open-maritime-context.xml"})
public class RabbitClient {

    @Autowired
    private RabbitGateway rabbitGateway;

    @Test
    public void testSendMessage() throws Exception {
        String json = new Gson().toJson(createMessage());
        rabbitGateway.alert(json);
    }

    private Message createMessage(){
        Message message = new Message();
        message.setType(Message.MessageType.SMS);
        message.setContent("ABC123");
        message.setRecipient("123");
        return message;
    }
}
